package com.mrt.chatgpt.data.domain.opai.model.aggregates;


import com.mrt.chatgpt.data.types.common.Constants;
import com.mrt.chatgpt.data.types.enums.ChatGPTModel;
import com.mrt.chatgpt.data.domain.opai.model.entity.MessageEntity;
import com.mrt.chatgpt.data.types.enums.OpenAiChannel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @author Fuzhengwei bugstack.cn @小傅哥
 * @description
 * @create 2023-07-22 21:09
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ChatProcessAggregate {

  /** 用户id */
   private String openid;
    /** 验证信息 */
    private String token;
    /** 默认模型 */
    private String model = ChatGPTModel.GPT_3_5_TURBO.getCode();
    /** 问题描述 */
    private List<MessageEntity> messages;


    public boolean isWhiteList(String whiteListStr){
        String[] whiteList = whiteListStr.split(Constants.SPLIT);
        for(String whiteOpenid : whiteList){
            if(whiteOpenid.equals(openid)) return true;
        }
        return false;
    }

    public OpenAiChannel getChannel(){
        return OpenAiChannel.getChannel(this.model);
    }
}
